﻿using System.Web.Mvc;
using SocialPhotos.Models;
using SocialPhotos.Models.SqlExpressRepository;
using System.Security.Principal;
using WebMobile.Models;

namespace WebMobile.Controllers
{
    public class BaseController : Controller
    {
        protected IUserRepository _userRepository = new SqlExUserRepository();

        public void Intialize(BaseViewModel baseViewModel)
        {
            if (Request.IsAuthenticated)
            {
                IPrincipal p = System.Web.HttpContext.Current.User;
                baseViewModel.LoginUser = _userRepository.GetUserByUserName(p.Identity.Name);
            }
        }
    }
}
